﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Text;

namespace AppToolkit.WPF.UI
{
    /// <summary>
    /// Returns a stream that can be used to store state into.
    /// </summary>
    [ContractClass(typeof(StorageProviderContracts))]
    public interface IStorageProvider
    {
        /// <summary>
        /// Returns a stream for the given file name.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        Stream GetStoreStream(string fileName);
    }

    [ContractClassFor(typeof(IStorageProvider))]
    internal abstract class StorageProviderContracts : IStorageProvider
    {
        public Stream GetStoreStream(string fileName)
        {
            Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(fileName), "fileName");
            return default(Stream);
        }
    }
}
